
using System;

namespace Qdb.Ext
{
	/// <summary>
	/// qdb exception wrapper: Exceptions occurring during internal processing
	/// will be proliferated to the client calling code encapsulated in an exception
	/// of this type.
	/// </summary>
	/// <remarks>
	/// qdb exception wrapper: Exceptions occurring during internal processing
	/// will be proliferated to the client calling code encapsulated in an exception
	/// of this type. The original exception, if any, is available through
	/// QdbException#getCause().
	/// </remarks>
	[System.Serializable]
	public class QdbException : Exception
	{
		/// <summary>Simple constructor</summary>
		public QdbException() : this(null, null)
		{
		}

		/// <summary>Constructor with an exception message specified</summary>
		/// <param name="msg">exception message</param>
		public QdbException(string msg) : this(msg, null)
		{
		}

		/// <summary>Constructor with an exception cause specified</summary>
		/// <param name="cause">exception cause</param>
		public QdbException(Exception cause) : this(null, cause)
		{
		}

		/// <summary>
		/// Constructor with an exception message selected
		/// from the internal message collection.
		/// </summary>
		/// <remarks>
		/// Constructor with an exception message selected
		/// from the internal message collection.
		/// </remarks>
		/// <param name="messageConstant">internal qdb message number</param>
		public QdbException(int messageConstant) : this(Qdb.Internal.Messages
			.Get(messageConstant))
		{
		}

		/// <summary>Constructor with an exception message and cause specified</summary>
		/// <param name="msg">exception message</param>
		/// <param name="cause">exception cause</param>
		public QdbException(string msg, Exception cause) : base(msg, cause)
		{
		}
	}
}
